<?php

namespace Interactive\Reference;

include_once("Base.php");  

session_start(); 

/**
 * Renders list, create, edit and view
 *
 * @author Dagvadorj Galbadrakh <dagvadorj@interactive.mn> 
 * @notes 
 *      - Might also consider twig
 */
class Renderer {

    public static function asList($includePath, $elems, 
            $template = 'resources/templates/list.php') { 

        if (count($elems) > 0) { 
            $headers = $elems[0]->listHeaders(); 
        } else { 
            $headers = array(); 
        }
   
        $sessionBundle = array(); 

        foreach ($elems as $elem) { 
            $sessionBundle[$elem->id()] = $elem;  
        }

        $_SESSION["list"] = $sessionBundle; 
        include $template; 
    } 

}

?>
